home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************************/
- /* */
- /* Program Name: Stiletto */
- /* */
- /* File Name: ModuleWindow.c */
- /* */
- /* © Apple Computer, Inc. 1991-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1991-08-17 Chris Halim Original version */
- /* 1995-06-26 Jaakko Railo Version 2.0 */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- #include "Errors.h"
- #include "Resources.h"
- #include "Strings.h"
- #include "ToolUtils.h"
-
- #include "Constants.h"
- #include "LogWindow.h"
- #include "ModuleWindow.h"
- #include "Preferences.h"
- #include "TestModule.h"
- #include "Utilities.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- /****************************************** PROTOTYPES ******************************************/
-
- void AttachModuleWindowControls (ModuleWindowPtr moduleWindow);
-
- Boolean DoModuleWindowKeyDown (const EventRecord *theEvent);
- Boolean DoModuleWindowMouseDown (const EventRecord *theEvent);
- void DoModuleWindowClick (WindowPtr theWindow, const EventRecord * theEvent);
- void DoModuleWindowActivate (WindowPtr theWindow, Boolean becomingActive);
- void DoModuleWindowUpdate (WindowPtr theWindow);
- void DoModuleWindowOSEvent (const EventRecord *theEvent);
- void DoModuleWindowSuspend (Boolean doClipConvert);
- void DoModuleWindowResume (Boolean doClipConvert);
-
- void ChangeTestDirAlias (FSSpecPtr theFile, ModuleWindowPtr moduleWindow);
- OSErr CreateTestDirAlias (ModuleWindowPtr moduleWindow);
-
- void DisplaySelectedNames (ModuleWindowPtr moduleWindow);
-
- OSErr GetPathToChild (long * dirID, FSSpecPtr target);
- void BuildNameList (ModuleWindowPtr moduleWindow);
-
- void ExecuteSelectedNames (ModuleWindowPtr moduleWindow);
-
- void DumpModuleRecord (ModuleWindowPtr moduleWindow);
-
- /******************************************** GLOBALS *******************************************/
-
- extern LogWindowPtr gLogWindow;
-
- extern DlgHookYDUPP gGetDirDialogHookUPP;
- extern ModalFilterYDUPP gGetDirModalFilterUPP;
-
- /************************************************************************************************/
- /************************************************************************************************/
-
-
- #pragma segment ModuleWindow
- short CreateModuleWindow (ModuleWindowPtr * moduleWindow, const Rect * windowRect)
- {
- WindowPtr savedPort;
- Ptr tPtr;
- short height;
- OSErr errCode;
- RgnHandle grayRgn;
-
- /**
- ** Create storage for the window record. We will pass this to GetNewWindow().
- **
- **/
-
- tPtr = NewPtrClear (sizeof (ModuleWindowRec));
- if (tPtr == nil) {
- AlertUser ("\pNot enough memory to create module window !", MemError ());
- return (-1);
- }
-
- /**
- ** Get a "WIND" resource for the module window.
- **
- **/
-
- if (HasColorQD())
- *moduleWindow = (ModuleWindowPtr) GetNewCWindow (rModuleWIND, tPtr, (WindowPtr)(-1L));
- else
- *moduleWindow = (ModuleWindowPtr) GetNewWindow (rModuleWIND, tPtr, (WindowPtr)(-1L));
-
- if (*moduleWindow == nil) {
- AlertUser ("\pUnable to get a WIND resource for module window!", ResError ());
- DisposPtr (tPtr);
- tPtr = nil;
- return (-1);
- }
-
- /**
- ** Move and resize the window according to the rect passed in windowRect.
- ** Also make sure that the window is within the screen boundary.
- **
- **/
-
- grayRgn = GetGrayRgn ();
- if (windowRect && !EmptyRect(windowRect) && RectInRgn (windowRect, grayRgn)) {
- MoveWindow ((WindowPtr) *moduleWindow, windowRect->left, windowRect->top, false);
- height = windowRect->bottom - windowRect->top;
- SizeWindow ((WindowPtr) *moduleWindow, windowRect->right - windowRect->left,
- height, true);
- }
-
- /**
- ** Set the window's characteristics.
- **
- **/
-
- GetPort (&savedPort);
- SetPort ((WindowPtr) *moduleWindow);
- TextSize (9);
- SetPort (savedPort);
-
- AttachModuleWindowControls (*moduleWindow);
-
- ShowWindow ((WindowPtr) *moduleWindow);
-
- if ((errCode = CreateTestDirAlias (*moduleWindow)) != noErr)
- PutLine (gLogWindow, "### Cannot create alias record : %d", errCode);
-
- if (CreateNameList (*moduleWindow) != noErr)
- PutLine (gLogWindow, "### Cannot create the name list : %d", MemError ());
-
- return (noErr);
- }
-
-
- #pragma segment ModuleWindow
- void DisposeModuleWindow (ModuleWindowPtr moduleWindow)
- {
- if (moduleWindow) {
- if (moduleWindow->fNameList != nil)
- LDispose (moduleWindow->fNameList);
-
- SaveToPrefFile ((Handle) moduleWindow->fTestDirAlias, rAliasType, rTestDirALIS);
-
- if (moduleWindow->fTestDirAlias != nil)
- DisposHandle ((Handle) moduleWindow->fTestDirAlias);
-
- DisposeWindow ((WindowPtr) moduleWindow);
- }
- }
-
-
- #pragma segment ModuleWindow
- void AttachModuleWindowControls (ModuleWindowPtr moduleWindow)
- {
- #pragma unused (moduleWindow)
- }
-
-
- #pragma segment ModuleWindow
- Boolean IsHandledByModuleWindow (ModuleWindowPtr moduleWindow, const EventRecord * theEvent)
- {
- WindowPtr theWindow;
- Boolean wasHandled = false;
-
- if (moduleWindow != nil) {
-
- switch ( theEvent->what ) {
- case mouseDown:
- (void) FindWindow(theEvent->where, &theWindow);
- if (theWindow == (WindowPtr) moduleWindow) {
- wasHandled = DoModuleWindowMouseDown (theEvent);
- }
- break;
-
- case activateEvt:
- if ((ModuleWindowPtr) theEvent->message == moduleWindow) {
- DoModuleWindowActivate ((WindowPtr) moduleWindow, (theEvent->modifiers & activeFlag) != 0);
- wasHandled = true;
- }
- break;
-
- case updateEvt:
- if ((ModuleWindowPtr) theEvent->message == moduleWindow) {
- DoModuleWindowUpdate ((WindowPtr) moduleWindow);
- wasHandled = true;
- }
- break;
-
- case osEvt:
- if ((ModuleWindowPtr) FrontWindow () == moduleWindow) {
- DoModuleWindowOSEvent (theEvent);
- wasHandled = false;
- }
- break;
-
- case keyDown:
- case autoKey:
- if ((ModuleWindowPtr) FrontWindow() == moduleWindow)
- wasHandled = DoModuleWindowKeyDown (theEvent);
- break;
-
- default :
- wasHandled = false;
- }
- }
-
- return (wasHandled);
- }
-
-
- #pragma segment ModuleWindow
- Boolean DoModuleWindowKeyDown (const EventRecord *theEvent)
- {
- char key;
- Boolean wasHandled = false;
- ModuleWindowPtr moduleWindow = (ModuleWindowPtr) FrontWindow ();
-
- key = theEvent->message & charCodeMask;
- if ( theEvent->modifiers & cmdKey ) { // Command key is down
- wasHandled = false;
- } else {
- switch (key) {
- case leftArrowKey :
- case upArrowKey :
- SelectPreviousCell (moduleWindow->fNameList);
- wasHandled = true;
- break;
-
- case rightArrowKey :
- case downArrowKey :
- SelectNextCell (moduleWindow->fNameList);
- wasHandled = true;
- break;
-
- case crKey :
- case enterKey :
- ExecuteSelectedNames (moduleWindow);
- wasHandled = true;
- break;
-
- case 'd' :
- DumpModuleRecord (moduleWindow);
- wasHandled = true;
- break;
-
- case 'c' :
- if (GetNewTestDirAlias (moduleWindow))
- (void) CreateNameList (moduleWindow);
- wasHandled = true;
- break;
-
- case 'r' :
- (void) CreateNameList (moduleWindow);
- wasHandled = true;
- break;
-
- default :
- wasHandled = false;
- }
- }
-
- return (wasHandled);
- }
-
-
- #pragma segment ModuleWindow
- Boolean DoModuleWindowMouseDown (const EventRecord *theEvent)
- {
- short part;
- WindowPtr theWindow;
- Boolean wasHandled = false;
-
- part = FindWindow(theEvent->where, &theWindow);
- switch ( part ) {
- case inContent:
- if ( theWindow != FrontWindow() )
- SelectWindow(theWindow);
-
- DoModuleWindowClick (theWindow, theEvent);
-
- wasHandled = true;
- break;
-
- default :
- wasHandled = false;
- }
-
- return (wasHandled);
- }
-
-
- #pragma segment ModuleWindow
- void DoModuleWindowClick (WindowPtr theWindow, const EventRecord * theEvent)
- {
- Point mousePos;
- Boolean dblClicked;
- WindowPtr savedPort;
- short part, value;
- ListHandle nameList = ((ModuleWindowPtr) theWindow)->fNameList;
- ControlHandle theControl;
-
- GetPort (&savedPort);
- SetPort (theWindow);
-
- mousePos = theEvent->where;
- GlobalToLocal (&mousePos);
-
- if (nameList != nil) {
- dblClicked = LClick (mousePos, theEvent->modifiers, nameList);
-
- if (dblClicked == true) {
- ExecuteSelectedNames ((ModuleWindowPtr) theWindow);
- }
- }
-
- part = FindControl (mousePos, theWindow, &theControl);
- switch (part) {
- case 0 : // invisible or inactive control was clicked
- break;
-
- case inThumb :
- break;
-
- case inButton :
- part = TrackControl (theControl, mousePos, nil);
- if (part != 0) {
- switch (GetCRefCon (theControl)) {
- }
- }
- break;
-
- case inCheckBox:
- part = TrackControl (theControl, mousePos, nil);
- if (part != 0) {
- value = (GetCtlValue (theControl)) ? false : true;
-
- switch (GetCRefCon (theControl)) {
- }
-
- SetCtlValue (theControl, value);
- }
- break;
- }
-
- SetPort (savedPort);
- }
-
-
- #pragma segment ModuleWindow
- void DoModuleWindowActivate (WindowPtr theWindow, Boolean becomingActive)
- {
- WindowPtr savedPort;
-
- GetPort (&savedPort);
- SetPort (theWindow);
-
- if (((ModuleWindowPtr) theWindow)->fNameList != nil)
- LActivate (becomingActive, ((ModuleWindowPtr) theWindow)->fNameList);
-
- SetPort (savedPort);
- }
-
-
- #pragma segment ModuleWindow
- void DoModuleWindowUpdate (WindowPtr theWindow)
- {
- WindowPtr savedPort;
- Rect tRect;
- ListHandle nameList = ((ModuleWindowPtr) theWindow)->fNameList;
-
- GetPort (&savedPort);
- SetPort (theWindow);
-
- BeginUpdate (theWindow);
- if ( ! EmptyRgn (theWindow->visRgn) )
- {
- // EraseRect(&theWindow->portRect);
- UpdtControl (theWindow, theWindow->visRgn);
-
- if (nameList != nil) {
- LUpdate (theWindow->visRgn, nameList);
-
- tRect = (*nameList)->rView;
- InsetRect (&tRect, -1, -1);
- FrameRect (&tRect);
- }
- }
- EndUpdate (theWindow);
-
- SetPort (savedPort);
- }
-
-
- #pragma segment ModuleWindow
- void DoModuleWindowOSEvent (const EventRecord *theEvent)
- {
- Boolean doConvert;
- unsigned char evType;
-
- evType = (unsigned char) (theEvent->message >> 24) & 0x00ff; // Get the high byte.
- switch (evType) { // The high byte of message is the type of event.
- case suspendResumeMessage :
- doConvert = (theEvent->message & convertClipboardFlag) != 0;
-
- if ((theEvent->message & resumeFlag) == 0)
- DoModuleWindowSuspend (doConvert);
-
- else DoModuleWindowResume (doConvert);
- break;
- }
- }
-
-
- #pragma segment ModuleWindow
- void DoModuleWindowSuspend (Boolean doClipConvert)
- {
- #pragma unused (doClipConvert)
-
- DoModuleWindowActivate (FrontWindow(), false);
- }
-
-
- #pragma segment ModuleWindow
- void DoModuleWindowResume (Boolean doClipConvert)
- {
- #pragma unused (doClipConvert)
-
- WindowPtr theWindow = FrontWindow ();
- CursHandle watch = GetCursor(watchCursor);
-
- if (watch != nil)
- SetCursor (*watch);
-
- (void) CreateNameList ((ModuleWindowPtr) theWindow);
- DoModuleWindowActivate (theWindow, true);
-
- if (watch != nil)
- ReleaseResource ((Handle) watch);
-
- SetCursor (&qd.arrow);
- }
-
-
- #pragma segment ModuleWindow
- pascal Boolean GetDirModalFilter (DialogPtr theDialog, EventRecord* theEvent, short* itemHit, Ptr data)
- {
- #pragma unused (theDialog, data)
-
- Boolean wasHandled = false;
- char key;
-
- switch (theEvent->what) {
- case keyDown :
- key = theEvent->message & charCodeMask;
- if ( theEvent->modifiers & cmdKey ) // Command key is down
- if (key == downArrowKey) {
- *itemHit = kOpen;
- wasHandled = true;
- }
- else if (key == upArrowKey) {
- *itemHit = sfHookGoToParent;
- wasHandled = true;
- }
- break;
-
- case mouseDown :
- break;
- }
-
- return (wasHandled);
- }
-
-
- #pragma segment ModuleWindow
- pascal short GetDirDialogHook (short item, DialogPtr theDialog, Ptr data)
- {
- #pragma unused (theDialog)
-
- short itemType;
- Handle itemHandle;
- Rect box;
- StandardFileReply *theSFRPtr = (StandardFileReply*) data;
- static Boolean wasFile = true;
- static Boolean firstTime;
-
- switch (item) {
- case sfHookNullEvent :
- if (theSFRPtr->sfIsFolder || theSFRPtr->sfIsVolume) {
- if (wasFile || firstTime) {
- GetDItem (theDialog, sfItemOpenButton, &itemType, &itemHandle, &box);
- setctitle((ControlHandle) itemHandle, "Directory");
-
- GetDItem (theDialog, kOpen, &itemType, &itemHandle, &box);
- HiliteControl ((ControlHandle) itemHandle, 0x0);
-
- wasFile = false;
- firstTime = false;
- }
- }
- else{
- if ((! wasFile) || firstTime) {
- GetDItem (theDialog, sfItemOpenButton, &itemType, &itemHandle, &box);
- setctitle((ControlHandle) itemHandle, "Open");
-
- GetDItem (theDialog, kOpen, &itemType, &itemHandle, &box);
- HiliteControl ((ControlHandle) itemHandle, 0xFF);
-
- wasFile = true;
- firstTime = false;
- }
- }
- break;
-
- case sfHookFirstCall :
- firstTime = true;
- break;
-
- case sfItemFileListUser :
- break;
-
- case sfHookOpenFolder :
- item = sfItemOpenButton;
- break;
-
- case kOpen :
- item = sfHookOpenFolder;
- break;
- }
-
- return (item);
- }
-
-
- #pragma segment ModuleWindow
- AliasHandle GetNewTestDirAlias (ModuleWindowPtr moduleWindow)
- {
- AliasHandle aliasHandle = nil;
- StandardFileReply theSFR;
- SFTypeList theTypeList;
- Point where;
- OSErr errCode;
-
- theTypeList[0] = kModuleType;
-
- SetPt (&where, -1, -1);
- CustomGetFile (nil, 1, theTypeList, &theSFR, rGetDirectoryDLOG, where,
- gGetDirDialogHookUPP, gGetDirModalFilterUPP, nil, nil, (Ptr) &theSFR);
-
- if (theSFR.sfGood)
- {
- if (! (theSFR.sfIsFolder || theSFR.sfIsVolume)) { // set up to its parent
- errCode = FSMakeFSSpec (theSFR.sfFile.vRefNum, theSFR.sfFile.parID, "\p", &theSFR.sfFile);
- if ((errCode) != noErr)
- PutLine (gLogWindow, "### FSMakeFSSpec failed : %d", errCode);
- }
-
- ChangeTestDirAlias (&theSFR.sfFile, moduleWindow);
- aliasHandle = moduleWindow->fTestDirAlias;
- }
-
- return (aliasHandle);
- }
-
-
- #pragma segment ModuleWindow
- void ChangeTestDirAlias (FSSpecPtr theFile, ModuleWindowPtr moduleWindow)
- {
- AliasHandle aliasHandle = nil;
- OSErr errCode = noErr;
-
- if (moduleWindow->fTestDirAlias != nil) {
- DisposHandle ((Handle) moduleWindow->fTestDirAlias);
- moduleWindow->fTestDirAlias = nil;
- }
-
- errCode = NewAlias (nil, theFile, &aliasHandle);
- if (aliasHandle == nil)
- PutLine (gLogWindow, "### NewAlias failed : %d", errCode);
-
- moduleWindow->fTestDirAlias = aliasHandle;
- }
-
-
- #pragma segment ModuleWindow
- OSErr CreateTestDirAlias (ModuleWindowPtr moduleWindow)
- {
- /**
- ** This function initializes moduleWindow->fTestDirAlias.
- ** First it attempts to get an 'alis' resource from the pref file.
- ** If successful, it will attach it resource handle to fTestDirAlias.
- ** If the resource is not found, it creates a new alias by first
- ** calling GetNewTestDirAlias(). If this calls return zero, it will
- ** create a new alias record based on the current working directory.
- **
- **/
-
- AliasHandle aliasHandle;
- FSSpec target;
- long dirID, procID = 0;
- short vRefNum = 0;
- OSErr errCode = noErr;
-
- if ((aliasHandle = (AliasHandle) GetFromPrefFile (rAliasType, rTestDirALIS)) == nil) {
- aliasHandle = GetNewTestDirAlias (moduleWindow);
- if (aliasHandle == nil) {
- if ((errCode = GetWDInfo (0, &vRefNum, &dirID, &procID)) != noErr)
- PutLine (gLogWindow, "### GetWDInfo failed : %d", errCode);
-
- if ((errCode = FSMakeFSSpec (vRefNum, dirID, nil, &target)) != noErr)
- PutLine (gLogWindow, "### FSMakeFSSpec failed : %d", errCode);
-
- if ((errCode = NewAlias (nil, &target, &aliasHandle)) != noErr)
- PutLine (gLogWindow, "### NewAlias failed : %d", errCode);
- }
- AddToPrefFile ((Handle) aliasHandle, rAliasType, rTestDirALIS, "\p");
- }
-
- moduleWindow->fTestDirAlias = aliasHandle;
-
- return (errCode);
- }
-
-
- #pragma segment ModuleWindow
- OSErr CreateNameList (ModuleWindowPtr moduleWindow)
- {
- Rect rView, dataBounds;
- Point cSize;
- GrafPtr savedPort;
- FontInfo grafPortFontInfo;
- short lineHeight, result = noErr;
- Rect **rectHandle;
-
- if (moduleWindow->fNameList != nil) {
- LDispose (moduleWindow->fNameList);
- moduleWindow->fNameList = nil;
- }
-
- GetPort (&savedPort);
- SetPort ((WindowPtr) moduleWindow);
-
- GetFontInfo (&grafPortFontInfo);
- lineHeight = grafPortFontInfo.ascent
- + grafPortFontInfo.descent
- + grafPortFontInfo.leading;
-
- SetRect (&dataBounds, 0, 0, 1, 0); // one-column list
-
- SetPt (&cSize, 0, 0); // use default cell size
-
- rectHandle = (Rect **) Get1Resource ('RECT', rFileListRECT);
- if (rectHandle) {
- rView = **rectHandle;
- rView.right -= 15;
- ReleaseResource ((Handle) rectHandle);
-
- if (moduleWindow->fNameList = lnew (&rView, &dataBounds, &cSize, 0, (WindowPtr)moduleWindow,
- true, false, false, true)) {
-
- LActivate (false, moduleWindow->fNameList);
-
- LDoDraw (false, moduleWindow->fNameList);
- BuildNameList (moduleWindow);
- LDoDraw (true, moduleWindow->fNameList);
-
- InvalRect (&rView);
- }
- else
- result = -1;
- }
- else {
- AlertUser ("\pUnable to get a RECT resource for module window!", ResError ());
- result = (-1);
- }
-
- SetPort (savedPort);
-
- return (result);
- }
-
-
- #pragma segment ModuleWindow
- void DisplaySelectedNames (ModuleWindowPtr moduleWindow)
- {
- Cell tCell;
-
- SetPt (&tCell, 0, 0);
- while (LGetSelect (true, &tCell, moduleWindow->fNameList)) {
-
- PutLine (gLogWindow, "row = %d", tCell.v);
-
- if (! LNextCell (true, true, &tCell, moduleWindow->fNameList))
- break;
- }
- }
-
-
- #pragma segment ModuleWindow
- OSErr GetPathToChild (long * dirID, FSSpecPtr target)
- {
- CInfoPBRec paramBlock;
- OSErr errCode;
-
- paramBlock.hFileInfo.ioCompletion = nil;
- paramBlock.hFileInfo.ioNamePtr = (StringPtr) &target->name;
- paramBlock.hFileInfo.ioVRefNum = target->vRefNum;
- paramBlock.hFileInfo.ioFDirIndex = 0;
- paramBlock.hFileInfo.ioDirID = target->parID;
-
- errCode = PBGetCatInfo (¶mBlock, false);
- if (errCode == noErr) {
- *dirID = paramBlock.hFileInfo.ioDirID;
- }
-
- return (errCode);
- }
-
-
- #pragma segment ModuleWindow
- void BuildNameList (ModuleWindowPtr moduleWindow)
- {
- short index = 1, row = 0;
- Cell tCell;
- OSErr errCode;
- Boolean wasChanged, done = false;
- FSSpec target;
- CInfoPBRec paramBlock;
- long dirID;
-
- errCode = ResolveAlias (nil, moduleWindow->fTestDirAlias, &target, &wasChanged);
- if (errCode == noErr)
- {
- if (wasChanged)
- PutLine (gLogWindow, "moduleWindow->fTestDirAlias was changed");
-
- if ((errCode = GetPathToChild (&dirID, &target)) == noErr)
- {
- while (! done)
- {
- paramBlock.hFileInfo.ioCompletion = nil;
- paramBlock.hFileInfo.ioNamePtr = &target.name;
- paramBlock.hFileInfo.ioVRefNum = target.vRefNum;
- paramBlock.hFileInfo.ioFDirIndex = index++;
- paramBlock.hFileInfo.ioDirID = dirID;
-
- errCode = PBGetCatInfo (¶mBlock, false);
- if (errCode == noErr) {
- if ((paramBlock.hFileInfo.ioFlAttrib & (1 << 4))
- || (((FInfo*) ¶mBlock.hFileInfo.ioFlFndrInfo)->fdType!=kModuleType))
- ;
- else {
- SetPt (&tCell, 0, row);
- LAddRow (1, row, moduleWindow->fNameList);
- LSetCell (&target.name[1], target.name[0], tCell, moduleWindow->fNameList);
- row++;
- }
- }
- else {
- if (errCode != fnfErr)
- PutLine (gLogWindow, "### GetCatInfo failed : %d", errCode);
- done = true;
- }
- }
-
- if (row > 0) { // hilite the first row & column
- SetPt (&tCell, 0, 0);
- LSetSelect (true, tCell, moduleWindow->fNameList);
- }
- }
- else
- PutLine (gLogWindow, "### GetPathToChild failed : %d", errCode);
- }
- else
- PutLine (gLogWindow, "### ResolveAlias failed : %d", errCode);
- }
-
-
- #pragma segment ModuleWindow
- void ExecuteSelectedNames (ModuleWindowPtr moduleWindow)
- {
- Cell tCell;
- FSSpec target;
- Str63 name;
- short dataLen;
- OSErr errCode;
- Boolean wasChanged, firstTime = true;
- long dirID;
-
- errCode = ResolveAlias (nil, moduleWindow->fTestDirAlias, &target, &wasChanged);
- if (errCode == noErr)
- {
- SetPt (&tCell, 0, 0);
- while (LGetSelect (true, &tCell, moduleWindow->fNameList)) {
-
- dataLen = 63;
- LGetCell(&name[1], &dataLen, tCell, moduleWindow->fNameList);
- name[0] = dataLen;
-
- if (firstTime) {
- firstTime = false;
-
- if ((errCode = GetPathToChild (&dirID, &target)) != noErr)
- PutLine (gLogWindow, "### GetPathToChild failed : %d", errCode);
- }
-
- if ((errCode = FSMakeFSSpec (target.vRefNum, dirID, name, &target)) != noErr)
- PutLine (gLogWindow, "### FSMakeFSSpec failed : %d", errCode);
- else
- ExecuteModule (&target);
-
- if (! LNextCell (true, true, &tCell, moduleWindow->fNameList))
- break;
- }
- }
- }
-
-
- #pragma segment ModuleWindow
- void DumpModuleRecord (ModuleWindowPtr moduleWindow)
- {
- AliasHandle theAlias = moduleWindow->fTestDirAlias;
- Str63 tStr;
- OSErr errCode;
-
- PutLine (gLogWindow, "====== Module Window ======");
- PutLine (gLogWindow, " fWindowRecord = 0x%08x", moduleWindow->fWindowRecord);
- PutLine (gLogWindow, " fNameList = 0x%08x", moduleWindow->fNameList);
- PutLine (gLogWindow, " fTestDirAlias = 0x%08x", theAlias);
-
- if ((errCode = GetAliasInfo (theAlias, asiVolumeName, tStr)) == noErr)
- PutLine (gLogWindow, " volume = %s", p2cstr(tStr));
- else
- PutLine (gLogWindow, "### GetAliasInfo failed : %d", errCode);
-
- if ((errCode = GetAliasInfo (theAlias, asiParentName, tStr)) == noErr)
- PutLine (gLogWindow, " parent = %s", p2cstr(tStr));
- else
- PutLine (gLogWindow, "### GetAliasInfo failed : %d", errCode);
-
- if ((errCode = GetAliasInfo (theAlias, asiAliasName, tStr)) == noErr)
- PutLine (gLogWindow, " target = %s", p2cstr(tStr));
- else
- PutLine (gLogWindow, "### GetAliasInfo failed : %d", errCode);
- }